package com.example.sneakerappserver.service;

import com.example.sneakerappserver.pojo.OrderItem;
import com.example.sneakerappserver.repository.OrderItemRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderItemService implements IOrderItemService{
    @Autowired
    OrderItemRepository orderItemRepository;

    @Override
    public void add(List<OrderItem> items) {
        orderItemRepository.saveAll(items);
    }

    @Override
    public List<OrderItem> queryByOrderId(Long orderId) {
        return orderItemRepository.findAllByOrderId(orderId);
    }

    @Override
    public void deleteItem(List<OrderItem> items) {
        orderItemRepository.deleteAll(items);
    }


}
